# $Id: PKGBUILD 90091 2013-05-06 19:39:36Z foutrelis $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Juergen Hoetzel <juergen@archlinux.org>
# Contributor: Kritoke <typeolinux@yahoo.com>

pkgname=smc
pkgver=1.9
pkgrel=21
pkgdesc="Secret Maryo Chronicles"
arch=('i686' 'x86_64')
url="http://www.secretmaryo.org/"
license=('GPL3')
depends=('sdl_image' 'sdl_ttf' 'sdl_mixer' 'cegui' 'boost-libs' 'smc-data')
makedepends=('autoconf' 'automake' 'boost')
source=(http://downloads.sourceforge.net/smclone/$pkgname-$pkgver.tar.bz2
        smc-for-cegui-v0-7.diff
        boost_filesystem3.diff
        smc.desktop
        smc.png)
md5sums=('75ab7826303c49aec25b052a8b90287f'
         '51dfea21b741ad19df14e738df52f1cf'
         '309a5a6d4b3c0b3dc5e1b7f4de84086f'
         '80fe208132ff41dd7677a53ee429ecdb'
         'efca7580e28748625eb676c9d24ee122')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  # to remove when smc will be compatible with cegui-0.7.x
  patch -Np1 -i "${srcdir}/smc-for-cegui-v0-7.diff"
  # fix compilation
  export CXXFLAGS="${CXXFLAGS} -fpermissive"
  # fix for boost >= 1.50
  patch -Np1 -i "${srcdir}/boost_filesystem3.diff"

  ./autogen.sh
  LIBS+="-lX11 -lboost_system" ./configure --prefix=/usr
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  make install DESTDIR="$pkgdir"
  # install some freedesktop.org compatibility
  install -Dm644 "$srcdir/$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
  install -Dm644 "$srcdir/$pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"

  rm -rf "$pkgdir/usr/share/smc/"
}
